<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
<title>${autoForm.name}</title>
<%@ include file="/WEB-INF/layouts/comm/kindeditor.jsp"%>
<%@ include file="/WEB-INF/layouts/comm/form.jsp"%>
</head>
<body>
	<div class="mod_header">
		<div class="title">
			<h2 id="h_title">${autoForm.name}-编辑表单输入项</h2>
		</div>
	</div>
	<ol class="breadcrumb">
		<li><a href="#">微信设置</a></li>
		<li><a href="${ctx}/webCustomer/autoForm/index">万能表单</a></li>
		<li><a
			href="${ctx}/webCustomer/autoForm/item/index?autoFormId=${autoForm.id}">${autoForm.name}-表单输入项</a></li>
		<li class="active">编辑表单输入项</li>
	</ol>
	<div class="mod_basic">
		<div class="title">
			<h3>编辑表单输入项</h3>
		</div>

		<div class="content">
			<div class="sub_content">
				<form class="form-horizontal" action="update" id="adv_form"
					method="post">
					<input type="hidden" class="form-control" id="id" name="id"
						value="${autoFormInput.id}"> <input type="hidden"
						class="form-control" id="autoFormId" name="autoFormId"
						value="${autoForm.id}">
					<div class="form-group">
						<label for="resTime" class="col-sm-2 control-label">显示名称*：</label>
						<div class="col-sm-10">
							<input type="text" class="form-control" id="name" name="name"
								value="${autoFormInput.name}">
						</div>
					</div>
					<div class="form-group">
						<label for="resTime" class="col-sm-2 control-label">输入类型*：</label>
						<div class="col-sm-10">
							<select name="type" id="type" class="form-control"
								onchange="inputtypeChange()">
								<option value="text"
									${ autoFormInput.type eq 'text' ? 'selected="selected"':''}>文本输入框</option>
								<option value="textarea"
									${ autoFormInput.type eq 'textarea'?'selected="selected"':''}>多行文本输入框</option>
								<option value="select"
									${ autoFormInput.type eq 'select'?'selected="selected"':''}>下拉列表</option>
							</select>
						</div>
					</div>
					<div
						class="form-group ${autoFormInput.type eq 'select'? 'show' : 'hidden' }"
						id="selectvd">
						<label for="resTime" class="col-sm-2 control-label">选项:</label>
						<div class="col-sm-10">
							<input type="text" class="form-control" id="selectv"
								name="selectv" value="${autoFormInput.selectv}"> <span
								id="helpBlock" class="help-block">下拉列表的各个选项，多个选项用“|”隔开</span>
						</div>
					</div>
					<div class="form-group">
						<label for="resTime" class="col-sm-2 control-label">是否必填*：</label>
						<div class="col-sm-10">
							<select name="rq" id="rq" class="form-control">
								<option value="1"
									${ autoFormInput.rq == 1?'selected="selected"':''}>必填</option>
								<option value="0"
									${ autoFormInput.rq == 0?'selected="selected"':''}>不是必填</option>
							</select>
						</div>
					</div>
					<div class="form-group">
						<label for="resTime" class="col-sm-2 control-label">排序*：</label>
						<div class="col-sm-10">
							<input type="text" class="form-control layer-date" id="orderId"
								name="orderId" value="${autoFormInput.orderId}">
						</div>
					</div>
					<div class="form-group">
						<div class="col-sm-offset-2 col-sm-10">
							<button type="submit" class="btn btn-primary">保存</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
	<footer_body> <script>
		base.menu.active('menu_205');

		base.form.validation("#adv_form", {
			rules : {
				name : {
					required : true
				},
				type : {
					required : true
				},
				rq : {
					required : true
				},
				orderId : {
					required : true,
					digits : true
				}
			},
			ignore : ""
		});

		base.form
				.ajaxSubmit({
					formid : '#adv_form',
					cbfun : function(data) {
						if (data.data == true) {
							BootstrapDialog
									.show({
										message : "设置成功",
										size : BootstrapDialog.SIZE_SMALL,
										buttons : [
												{
													label : '继续编辑',
													cssClass : 'btn-success',
													action : function(dialogRef) {
														window.location.href = "${ctx}/webCustomer/autoForm/item/add?autoFormId=${autoForm.id}&id=${autoFormInput.id}";
													}
												},
												{
													label : '查看${autoForm.name}-表单输入项',
													cssClass : 'btn-warning',
													action : function(dialogRef) {
														window.location.href = "${ctx}/webCustomer/autoForm/item/index?autoFormId=${autoForm.id}";
													}
												} ]
									});
						} else {
							BootstrapDialog.alert("保存失败，请重试");
						}
					}
				});

		function inputtypeChange() {
			if ($('#type').val() == 'select') {
				$('#selectvd').removeClass('hidden').addClass('show');
			} else {
				$('#selectvd').removeClass('show').addClass('hidden');
			}
		}
		function selectvpChange() {
			if ($('#type').val() == 'select') {
				$('#selectvd').removeClass('hidden').addClass('show');
			} else {
				$('#selectvd').removeClass('show').addClass('hidden');
			}
		}
	</script> </footer_body>
</body>
</html>